import QtQuick
import QtQuick.Layouts
import QtCharts

Rectangle {
    Layout.fillWidth: true
    Layout.fillHeight: true

    PolarChartView {
        title: "极坐标图示例"
        titleFont.bold: true
        titleFont.pointSize: 14

        anchors.fill: parent
        legend.visible: false
        antialiasing: true

        ValueAxis {
            id: axisAngular
            min: 0
            max: 20
            tickCount: 9
        }

        ValueAxis {
            id: axisRadial
            min: -0.5
            max: 1.5
        }

        // 支持折线图、曲线图、面积图和散点图
        SplineSeries {
            id: series1
            axisAngular: axisAngular    //角度轴
            axisRadial: axisRadial      //径向轴
            pointsVisible: true
        }

        ScatterSeries {
            id: series2
            axisAngular: axisAngular
            axisRadial: axisRadial
            markerSize: 10
        }


        // Add data dynamically to the series
        Component.onCompleted: {
            for (var i = 0; i <= 20; i++) {
                series1.append(i, Math.random());
                series2.append(i, Math.random());
            }
        }
    }
}
